package com.lancoo.cvas.controller;

import com.lancoo.cvas.aspect.LogAnnotation;
import com.lancoo.cvas.entity.Teacher;
import com.lancoo.cvas.pojo.vo.TeacherGroup;
import com.lancoo.cvas.service.TeacherService;
import com.lancoo.cvas.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "教师")
@RestController
@RequestMapping("/api/v5.0.1/web/teacher")
public class TeacherController {

    @Resource
    private TeacherService teacherService;

    @ApiOperation("获取全部教师 根据课题组分组")
    @GetMapping(value = "/getTeacherListGroup")
    @LogAnnotation(operationType = "3", operationContent = "获取全部教师 根据课题组分组")
    public Result<List<TeacherGroup>> getTeacherListGroup(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                          @ApiParam(value = "学校Id", required = true) @RequestParam String schoolId,
                                                          @ApiParam(value = "学期", required = true) @RequestParam String term,
                                                          @ApiParam(value = "3规则 2排课课表", required = true) @RequestParam Integer module) {
        return Result.ofSuccess(teacherService.getTeacherListGroup(taskId,schoolId, term, module));
    }


    @ApiOperation("根据关键字获取对应教师")
    @GetMapping(value = "/getTeacherByKeyword")
    @LogAnnotation(operationType = "3", operationContent = "根据关键字获取对应教师")
    public Result<List<Teacher>> getTeacherByKeyword(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                     @ApiParam(value = "学校Id", required = true) @RequestParam String schoolId,
                                                     @ApiParam(value = "学期", required = true) @RequestParam String term,
                                                     @ApiParam(value = "教师关键字", required = true) @RequestParam String keyword) {
        return Result.ofSuccess(teacherService.getTeacherByKeyword(schoolId, term, keyword));
    }


}
